<template>
  <div id="docOrderDetails">
    <header>
      <i @click="goBack()"></i>
      <div>办卡详情</div>
    </header>
    <div class="box">

      <ul class="order">
        <li>
          <span>医生姓名:</span>
          <div>{{docinfo.name}}</div>
        </li>
        <li>
          <span>手机号:</span>
          <div>{{docinfo.phone}}</div>
        </li>
        <li>
          <span>就诊时段:</span>
          <div>{{docinfo.select_timeArr | toStr}}</div>
        </li>
        <li>
          <span>订单编号:</span>
          <div class="order_num">{{orderObj.order_num}}</div>
        </li>
      </ul>
    </div>
    <div class="footer">
      <a @click='commit()'>确定办卡</a>
    </div>
  </div>

</template>
<script>
  import {
    MessageBox
  } from 'mint-ui';
  export default {
    data() {
      return {
        time: '',
        id: '', //订单id
        orderObj: {},
        gids: [],
        docinfo: {}, //医生下单信息
        type: '',
        timeOutEvent: 0,
        user: '', //判断入口 医生or诊室
        start: '',
        end: '',
        obj: {
          starttime: '',
          endtime: '',
        },
      }
    },
    filters: {
      // 把数字转换成字符串
      toStr(arr) {
        if (arr) {
          const str = arr.join();
          return str;
        }
      },
      // 获取数组长度
      getLen(arr) {
        if (arr) {
          const len = arr.length;
          return len;
        }
      },
    },
    methods: {
      //返回上一级
      goBack() {
        this.$router.back();
      },
      //判断入口 医生还是诊室
      judgmentUser() {
        this.user = this.$route.query.user;
        this.id = this.$route.query.id;
        this.type = this.$route.query.type;
      },
      // 根据id获取订单详情
      getObj() {
        this.$api.get(this.$api.baseURLSchool, "select_cid/view_doctor_order_clinic/" + this.id, {}, r => {
          if (r.data.ret == 1) {
            this.orderObj = r.data.info;
            this.gids = JSON.parse(this.orderObj.gids);
            this.docinfo = JSON.parse(this.orderObj.docinfo);
          }
        }, err => {
          console.log(err);
        })
      },
      //确定办卡
      commit(){
      }

    },
    created() {
      this.judgmentUser();
      this.getObj();

    }
  }

</script>
<style lang="scss" scoped>
  .order_num {
    width: 2.7rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .footer {
    background: #fff;
    height: 55px;
    line-height: 55px;
    text-align: center;
    a {
      display: block;
      width: 194px;
      height: 35px;
      line-height: 35px;
      margin: 10px auto;
      text-align: center;
      font-size: 17px;
      border-radius: 20px;
      background: #e5322d;
      color: white;
    }
  }

</style>
